"use client";

import * as React from "react";
import {
  ContactRound,
  House,
  LibraryBig,
  PlaneTakeoff,
  SearchCode,
} from "lucide-react";

import { NavMain } from "@/components/nav-main";
import { NavUser } from "@/components/nav-user";
import {
  Sidebar,
  SidebarContent,
  SidebarFooter,
  SidebarHeader,
  SidebarMenu,
  SidebarMenuItem,
} from "@/components/ui/sidebar";
import Link from "next/link";
import Image from "next/image";

const data = {
  user: {
    name: "shadcn",
    email: "m@example.com",
    avatar: "/avatars/shadcn.jpg",
  },
  navMain: [
    {
      title: "首页",
      url: "/dashboard",
      icon: House,
    },
    {
      title: "生产运行",
      url: "/dashboard/operation",
      icon: PlaneTakeoff,
      // isActive: true,
      items: [
        {
          title: "航班动态",
          url: "/dashboard/operation/flight-schedule",
        },
        {
          title: "生产排班",
          url: "#",
        },
        {
          title: "技术管控",
          url: "#",
        },
      ],
    },
    {
      title: "安全质量",
      url: "/dashboard/safety-quality",
      icon: SearchCode,
      items: [
        {
          title: "质量管理",
          url: "#",
        },
        {
          title: "三基建设",
          url: "#",
        },
      ],
    },
    {
      title: "行政管理",
      url: "/dashboard/admin-mgmt",
      icon: ContactRound,
      items: [
        {
          title: "人员",
          url: "#",
        },
        {
          title: "行政",
          url: "#",
        },
        {
          title: "党建",
          url: "#",
        },
      ],
    },
    {
      title: "培训管理",
      url: "/dashboard/training",
      icon: LibraryBig,
      items: [
        {
          title: "培训计划",
          url: "#",
        },
        {
          title: "培训记录",
          url: "#",
        },
      ],
    },
  ],
};

export function AppSidebar({ ...props }: React.ComponentProps<typeof Sidebar>) {
  return (
    <Sidebar variant="inset" {...props}>
      <SidebarHeader>
        <SidebarMenu>
          <SidebarMenuItem>
            <Link href="#" className="flex">
              <Image src="/logo2.png" alt="logo" width={250} height={45} />
            </Link>
          </SidebarMenuItem>
        </SidebarMenu>
      </SidebarHeader>
      <SidebarContent>
        <NavMain items={data.navMain} />
      </SidebarContent>
      <SidebarFooter>
        <NavUser user={data.user} />
      </SidebarFooter>
    </Sidebar>
  );
}
